package homework022;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.Set;

public class Main {
    public static void main(String[] args) {

        HashMap<String, String> map = new HashMap<>(4);
        map.put("attr1", "全高清屏（1920×1080）");
        map.put("attr2", "轻薄笔记本");
        map.put("attr3", "Windows 10 带Office");
        map.put("attr4", "15.1mm—18.0mm");

        Goods goods = new Goods();
        goods.setAttrList(map);
        goods.setId("1");
        goods.setName("荣耀笔记本 MagicBook X 15 2021");
        goods.setPrice(3999);

        ArrayList<Goods> list = new ArrayList<>();
        list.add(goods);

        for (Goods goods1 : list) {
            System.out.println("商品编号：" + goods1.getId());
            System.out.println("商品名：" + goods1.getName());
            System.out.println("商品价格：" + goods1.getPrice());
            System.out.println("商品规格：");

            Set<String> keySet = goods1.getAttrList().keySet();
            for (String s : keySet) {
                String key = AttrEnums.getByEn(s);
                String value = goods1.getAttrList().get(s);
                System.out.println(key + ":" + value);
            }
        }
    }
}
